package org.destinyshine.cricket.utils;

import java.lang.reflect.Array;
import java.util.Collection;

public abstract class MyCollectionUtils {

    public static <T> T[] toArray(Collection<T> collection, Class<?> componentType) {
        if(collection == null) {
            return null;
        }
        T[] ary = (T[]) Array.newInstance(componentType, collection.size());
        return collection.toArray(ary);
    }
}
